cc.Class({
    extends: cc.Component,

    properties: {
        targetPosX: -200,
        targetPosY: 490,
        rotateAngle: 720,
    },

    // use this for initialization
    onLoad: function () {
    },

    initData: function (srcPosX, srcPosY){
        this.node.x = srcPosX;
        this.node.y = srcPosY;
        
        this.particleSystem = this.node.getComponent(cc.ParticleSystem);
        this.particleSystem.resetSystem(); 

        this.node.runAction(
            cc.sequence(cc.moveBy(1, this.targetPosX, this.targetPosY), 
                        cc.callFunc(
                                    function () {
                                        // console.log("Pos: " + this.node.x + ", " + this.node.y);
                                        this.particleSystem.stopSystem(); 
                                        this.node.destroy();
                                    }, 
                                    this
                        )
            )
        );
        
        // var rotateBy = cc.rotateBy(2, 720*3);
        // this.node.runAction(rotateBy);
    }
});
